package com.softstao.guoyu.mvp.presenter.shop;

import com.softstao.guoyu.model.shop.OrderCondition;
import com.softstao.guoyu.model.shop.OrderId;
import com.softstao.guoyu.model.shop.ProductType;
import com.softstao.guoyu.model.shop.ShopIndex;
import com.softstao.guoyu.mvp.interactor.shop.GoodsInteractor;
import com.softstao.guoyu.mvp.presenter.BasePresenter;
import com.softstao.guoyu.mvp.viewer.BaseViewer;
import com.softstao.guoyu.mvp.viewer.shop.AddOrderViewer;
import com.softstao.guoyu.mvp.viewer.shop.CategoryViewer;
import com.softstao.guoyu.mvp.viewer.shop.GoodsListViewer;

/**
 * Created by vaikus on 2017/6/15.
 */

public class GoodsPresenter extends BasePresenter<BaseViewer,GoodsInteractor> {
    public void getCategory(int agentId){
        interactor.getCategory(agentId,o -> ((CategoryViewer)viewer).getCategoryList((ProductType) o));
    }

    public void getGoodsList(int page, int agentId, String typeId){
        interactor.getGoodsList(page,agentId,typeId,o -> ((GoodsListViewer)viewer).getGoodsList((ShopIndex) o));
    }

    public void addOrder(OrderCondition condition){
        interactor.addOrder(condition,o -> ((AddOrderViewer)viewer).addResult((OrderId) o));
    }
}
